﻿<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0 minimal-ui"/>
	<meta name="apple-mobile-web-app-capable" content="yes"/>
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<title>表单 </title>
	<link rel="stylesheet" href="css/bootstrap.min.css" />
	<script type="text/javascript" src="js/jquery-2.1.4.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript" src="js/vue2.js"></script>
	<script type="text/javascript" src="js/biaodan.js"></script>
</head>
<body>
	<div class="container" id="box">
		<form role="form">
			<div class="form-group">
				<label for="username">用户名:</label>
				<input type="" id="username" class="form-control" placeholder="请输入用户名" v-model="username"/>
			</div>
			<div class="form-group">
				<label for="age">年龄:</label>
				<input type="" id="age" class="form-control" placeholder="请输入年龄" v-model="age"/>
			</div>
			<div class="form-group">
				<input type="button" id="add" class="btn btn-primary" value="添加" v-on:click="add()"/>
				<input type="button" id="resute" class="btn btn-danger" value="重置"/>
			</div>
		</form>
		<h2 class="text-center">用户信息表</h2>
		<table class="table table-bordered table-hover">
			<tr>
				<th class="text-center">序号</th>
				<th class="text-center">名字</th>
				<th class="text-center">年龄</th>
				<th class="text-center">操作</th>
			</tr>
			<tr class="text-center" v-for="(item,index) in myData">
				<td>{{index+1}}</td>
				<td>{{item.name}}</td>
				<td>{{item.age}}</td>
				<td><input type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#layer" value="删除" v-on:click="curIndex=index"/></td>
			</tr>
			<tr class="text-center" v-show="myData.length!=0">
				<td colspan="4"><input type="button" class="btn btn-danger btn-sm" data-toggle="modal" data-target="#layer"  value="全部删除" v-on:click="curIndex=-1"/></td>
			</tr>
			<tr v-show="myData.length==0">
				<td colspan="4" class="text-center text-muted">
					<p>......暂无数据......</p>
				</td>
			</tr>
		</table>
		<!-- 弹出框 -->
		<div class="modal" role="dialog" id="layer">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button class="close" data-dismiss="modal" >&times;</button>
						<h2 class="modal-tit">确定xxxx？</h2>
					</div>
					<div class="modal-body text-right">
						<button class="btn btn-primary btn-sm" data-dismiss="modal" v-on:click="deleteCur(curIndex)">确定</button>
						<button class="btn btn-danger btn-sm" data-dismiss="modal">取消</button>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>